package com.ling.feign.plus.annotation;

import com.ling.feign.plus.advice.AutoPackagingResponseBodyAdvice;
import com.ling.feign.plus.advice.GlobalServerExceptionHandler;
import com.ling.feign.plus.aspect.FeignClientAspect;
import com.ling.feign.plus.config.FeignConfiguration;
import com.ling.feign.plus.context.FeignEnvironmentAware;
import com.ling.feign.plus.support.FeignServerBusinessExceptionResolver;
import com.ling.feign.plus.support.FeignServerExceptionDecoder;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Import;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import({FeignEnvironmentAware.class,
        AutoPackagingResponseBodyAdvice.class,
        GlobalServerExceptionHandler.class,
        FeignServerBusinessExceptionResolver.class,
        FeignServerExceptionDecoder.class,
        FeignClientAspect.class})
@ImportAutoConfiguration({
        FeignConfiguration.class
})
@EnableFeignClients(defaultConfiguration = {FeignServerExceptionDecoder.class})
public @interface OpenFeignPlus {

}
